#ifndef __IMU_H
#define __IMU_H

#include "ch32f20x.h"                   // Device header

#include "ICM20602.h"

extern const float ACCEL_SCALE;
extern const float GYRO_SCALE;
typedef struct {
    float q0;
    float q1;
    float q2;
    float q3;
} Quaternion;

typedef struct {
    float roll;
    float pitch;
    float yaw;
} Attitude;

void IMU_Init(float sample_time);
void IMU_SetGyroBias(float gx_bias, float gy_bias, float gz_bias);
void IMU_GetQuaternion(Quaternion* q);
void IMU_Update(IMU_Data* data, Attitude* attitude);
void IMU_Reset(void);
void IMU_SetAlgorithmParam(float beta, float zeta);

#endif
